/* * All Rights Reserved * Changelog: * Li Guoliang - 2009-6-5: Initial version * @liguoliang.com */ /** * 获得给定日期的是该月的第几个day of week. 如2009.6.28日, 为2009.06月的第四个周日, 则返回4. * @param date_ 要计算周数的日期 * @return int 所在月的第几个周几. */ public static function getWeekOfMonth(date_:Date):int { var date:Date = new Date(date_.time); var month:int = date.month; var weekOfMonth:int = 0; while(true) { date.date -= 7; weekOfMonth ++; if(date.month != month) { break; } } return weekOfMonth; } /** * 获得给定日期的是该月的倒数第几个day of week. 如2009.6.28日, 为2009.06月的倒数第一个[最后一个]周日, 则返回1. * @param date_ 要计算周数的日期 * @return int 所在月的倒数第几个周day of week. */ public static function getWeekOfMonthFromLast(date_:Date):int { var date:Date = new Date(date_.time); var month:int = date.month; var weekOfMonthFromLat:int = 0; while(true) { date.date += 7; weekOfMonthFromLat ++; if(date.month != month) { break; } } return weekOfMonthFromLat; }
[2009.06.06] 时光永是流逝,街市依旧太平 <->
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.